<?
include_once('func.php');
if(isset($_GET[forgotpw])){
	$mailto=$_GET[forgotpw];
	$subject=parameters(8).''.SITE_FORGOT_NEW_PASSWORD;
	$rand = rand(100000, 600000);
	$db->UPDATE("UPDATE `".tablepre."user`  set password = '".md5($rand)."' where uid = ".$result[0][1]."");
	$cn = str_replace('{[password]}',$rand,parameters(28));
	//$cn=SITE_FORGOT_NEW_PASSWORD_2.' ('.$rand.')';
	}
set_time_limit(0); 

require_once('class.phpmailer.php');  
  
$mail             = new PHPMailer();  
  
  

  
//采用SMTP发送邮件  
$mail->IsSMTP();   
//邮件服务器  
$mail->Host       = parameters(16);   
$mail->SMTPDebug  = 4;    
//使用SMPT验证  
$mail->SMTPAuth   = true;    
//SMTP验证的用户名称  
$mail->Username   = parameters(15);   
//SMTP验证的秘密  
$mail->Password   = parameters(17);      
//设置编码格式  
$mail->CharSet  = "utf8";  
//设置主题  

  
//$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";   
//设置发送者  
$mail->SetFrom(parameters(15), 'test');  
//采用html格式发送邮件  

  
//接受者邮件名称  
$mail->AddAddress($mailto, "test");  

	$mail->Subject    = $subject;  
	$body             = $cn;  
	$mail->MsgHTML($body);  
	
	$mail->Send();


?>